﻿<%@ Page Language="C#" MasterPageFile="~/MasterPage.Master" AutoEventWireup="true"
    CodeBehind="Learning.aspx.cs" Inherits="EXAM.Learning" %>

<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder3" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolderMain" runat="server">

    <script type="text/javascript">
    function GetDataFromGrid_Report(sender,agrs)
        {
            var hdCOMMAND_TYPE = document.getElementById("<%=hdCOMMAND_TYPE.ClientID%>"); 
            hdCOMMAND_TYPE.value=agrs.get_argument().DlgRes;
            __doPostBack('<%=btnReload.UniqueID %>','');
        }
        
        function openWin_ViewLookUp()
        {
            var oWnd1 = radopen("./Windows/frmListQ.aspx", "Win_ViewReport");
            oWnd1.SetTitle("Question List");
        }
        
    function SetUniqueRadioButton(nameregex, current)
    {
       re = new RegExp(nameregex);
       for(i = 0; i < document.forms[0].elements.length; i++)
       {
          elm = document.forms[0].elements[i]
          if (elm.type == 'radio')
          {
             if (re.test(elm.name))
             {
               
                elm.disabled=true;
                 elm.checked = false;
             }
          }
       }
       
       tagR = document.getElementById("<%=mtq_stamp_.ClientID %>");
       if(current.parentNode.getAttribute("iscorrect")=="0")
       {
           tagR.className="mtq_stamp mtq_wrong_stamp";
           tagR.innerHTML="WRONG";
       }
       else if (current.parentNode.getAttribute("iscorrect")=="1")
       {
           tagR.className="mtq_stamp mtq_correct_stamp";
           tagR.innerHTML="correct";
       }
       current.checked = true;
       
    }
    
    function SetResultCheckBox(nameregex, current)
    {
       
       tagR = document.getElementById("<%=mtq_stamp_.ClientID %>");
//       if(current.parentNode.getAttribute("iscorrect")=="0")
//       {
//           tagR.className="mtq_stamp mtq_wrong_stamp";
//           tagR.innerHTML="WRONG";
//       }
//       else if (current.parentNode.getAttribute("iscorrect")=="1")
//       {
           re = new RegExp(nameregex);
           flag = true;
           for(i = 0; i < document.forms[0].elements.length; i++)
           {
              elm = document.forms[0].elements[i]
              if (elm.type == 'checkbox')
              {
                 if (re.test(elm.name))
                 {
                    if( (elm.parentNode.getAttribute("iscorrect")=="1"&&elm.checked==false)||
                        (elm.parentNode.getAttribute("iscorrect")=="0"&&elm.checked==true))
                        flag = false;
                 }
              }
           }
           if(flag)
           {
               tagR.className="mtq_stamp mtq_correct_stamp";
               tagR.innerHTML="correct";
           }
           else{
               tagR.className="mtq_stamp mtq_wrong_stamp";
               tagR.innerHTML="WRONG";
           }
           current.disabled=true;
           current.checked=true;
            
//       }
    }
    function SetResultTextBox(nameregex, current)
    {
        tagR = document.getElementById("<%=mtq_stamp_.ClientID %>");

        re = new RegExp(nameregex);
        flag = true;
        for(i = 0; i < document.forms[0].elements.length; i++)
        {
            elm = document.forms[0].elements[i]
            if (elm.type == 'text')
            {
                if (re.test(elm.name))
                {
                
                    if (elm.value.toLowerCase() != elm.getAttribute("iscorrect").toLowerCase())
                        flag = false;
                }
            }
        }
        if(flag)
        {
            tagR.className="mtq_stamp mtq_correct_stamp";
            tagR.innerHTML="correct";
        }
        else{
            tagR.className="mtq_stamp mtq_wrong_stamp";
            tagR.innerHTML="WRONG";
        }
        value = current.value;
        current.disabled=true;
        current.setAttribute("value",value);
    }
    </script>

    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Skin="Sunset">
    </telerik:RadAjaxLoadingPanel>
    <telerik:RadAjaxManagerProxy ID="RadAjaxManagerProxy1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="btnPrev">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="mtq_stamp_" />
                    <telerik:AjaxUpdatedControl ControlID="lbLine" />
                    <telerik:AjaxUpdatedControl ControlID="lbQuest" />
                    <telerik:AjaxUpdatedControl ControlID="lbExplan" />
                    <telerik:AjaxUpdatedControl ControlID="btnPrev" />
                    <telerik:AjaxUpdatedControl ControlID="btnNext" />
                    <telerik:AjaxUpdatedControl ControlID="lbType" />
                    <telerik:AjaxUpdatedControl ControlID="dlAnswer" LoadingPanelID="RadAjaxLoadingPanel1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="btnNext">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="mtq_stamp_" />
                    <telerik:AjaxUpdatedControl ControlID="lbLine" />
                    <telerik:AjaxUpdatedControl ControlID="lbQuest" />
                    <telerik:AjaxUpdatedControl ControlID="lbExplan" />
                    <telerik:AjaxUpdatedControl ControlID="btnPrev" />
                    <telerik:AjaxUpdatedControl ControlID="btnNext" />
                    <telerik:AjaxUpdatedControl ControlID="lbType" />
                    <telerik:AjaxUpdatedControl ControlID="dlAnswer" LoadingPanelID="RadAjaxLoadingPanel1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="btnReload">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="mtq_stamp_" />
                    <telerik:AjaxUpdatedControl ControlID="lbLine" />
                    <telerik:AjaxUpdatedControl ControlID="lbQuest" />
                    <telerik:AjaxUpdatedControl ControlID="lbExplan" />
                    <telerik:AjaxUpdatedControl ControlID="btnPrev" />
                    <telerik:AjaxUpdatedControl ControlID="btnNext" />
                    <telerik:AjaxUpdatedControl ControlID="lbType" />
                    <telerik:AjaxUpdatedControl ControlID="dlAnswer" LoadingPanelID="RadAjaxLoadingPanel1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="btnHint">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="lbExplan" />
                    <telerik:AjaxUpdatedControl ControlID="dlAnswer" LoadingPanelID="RadAjaxLoadingPanel1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="dlAnswer">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="lbExplan" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="btnList">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="mtq_stamp_" />
                    <telerik:AjaxUpdatedControl ControlID="lbLine" />
                    <telerik:AjaxUpdatedControl ControlID="lbQuest" />
                    <telerik:AjaxUpdatedControl ControlID="lbExplan" />
                    <telerik:AjaxUpdatedControl ControlID="btnPrev" />
                    <telerik:AjaxUpdatedControl ControlID="btnNext" />
                    <telerik:AjaxUpdatedControl ControlID="lbType" />
                    <telerik:AjaxUpdatedControl ControlID="dlAnswer" LoadingPanelID="RadAjaxLoadingPanel1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManagerProxy>
    <h2 class="art-postheader">
        Test Review
    </h2>
    <div class="cleared">
    </div>
    <div class="art-postcontent">
        <span id="mtq_quiztitle-1" class="mtq_quiztitle">
            <h2>
                <asp:Label ID="lbName" runat="server" Text="Label"></asp:Label></h2>
        </span><span id="mtq_instructions-1" class="mtq_instructions" style="display: block;">
            <asp:Label ID="lbDescription" runat="server" Text="Label"></asp:Label>
            <br />
        </span>&nbsp;<asp:HiddenField ID="lbPassScore" runat="server" />
        &nbsp;<asp:HiddenField ID="hdT0" runat="server" />
        <asp:Button ID="btnStart" runat="server" Text="Start" class="mtq_action_button mtq_css_button mtq_start_button"
            OnClick="btnStart_Click" Width="198px" />
        <span runat="server" class="mtq_quiz_results_bubble" id="mtq_quiz_results_bubble"
            style="display: block;" visible="false"><span class="mtq_quiz_results" id="mtq_quiz_results-1"
                style="display: block;">
                <p>
                    Congratulations - you have completed <em>Your learning</em>.</p>
                <div style="float: right; width: 128px; height: 128px; margin-right: 40px;">
                    <asp:Image ID="imgMsg" runat="server" ImageUrl="images/noimage.png" />
                </div>
                <p>
                    You answered
                    <asp:Literal ID="lbNumOfAns" runat="server"></asp:Literal>
                    out of
                    <asp:Literal ID="lbNumofQuest" runat="server"></asp:Literal>.</p>
                <p>
                    You have
                    <asp:Literal ID="lbCorrect" runat="server"></asp:Literal>
                    correct answers, rate is
                    <%=lbCorrect.Text%>/<%=lbNumOfAns.Text%></p>
                <p>
                    You scored
                    <asp:Literal ID="lbScore" runat="server"></asp:Literal>%.</p>
                <p>
                    <asp:Literal ID="lbNotes" runat="server"></asp:Literal>.</p>
                <br />
            </span><span class="mtq_quiz_results_highlight" id="mtq_quiz_results_highlight-1"
                style="display: block;">
                <telerik:RadButton ID="btn" runat="server" Text="Back to Learn Template" OnClick="btn_Click">
                </telerik:RadButton>
                <telerik:RadButton ID="btnPrint" runat="server" Text="Print Certificate" OnClick="btnPrint_Click">
                </telerik:RadButton><telerik:RadButton ID="btnSend" runat="server" 
            Text="Send Certificate" OnClick="btnSend_Click">
                </telerik:RadButton>
            </span><span class="mtq_quiz_results" id="mtq_quiz_results-1" style="display: block;">
            </span></span><span id="mtq_question_container" style="display: block;" runat="server">
                <div class="mtqscrollable" id="mtq_scroll_container-1" style="width: 100%;">
                    <div id="mtq_scroll_items_container-1" style="left: 0px; width: 100%">
                        <!-- root element for the items -->
                        <div class="mtq_question" id="mtq_question-1-1" style="width: 100%">
                            <span style="color: rgb(255, 102, 0);">
                                <asp:Literal ID="lbType" runat="server" Text="Question Type : [Type]"></asp:Literal></span>
                            <table class="mtq_question_heading_table">
                                <tbody>
                                    <tr>
                                        <td>
                                            <span class='mtq_question_label'>
                                                <asp:Literal ID="lbLine" runat="server" Text="Question [No]"></asp:Literal></span>
                                            <span id="mtq_stamp_" runat="server" class="mtq_stamp"></span>
                                        </td>
                                    </tr>
                                </tbody>
                            </table>
                            <span id="mtq_question_text-1-1" class="mtq_question_text">
                                <asp:Literal ID="lbQuest" runat="server" Text="Question........"></asp:Literal>
                            </span>
                            <asp:ListView ID="dlAnswer" runat="server" OnItemDataBound="dlAnswer_ItemDataBound"
                                OnItemCommand="dlAnswer_ItemCommand">
                                <ItemTemplate>
                                    <tr>
                                        <td class="mtq_letter_button_td">
                                            <span class="mtq_letter_button mtq_letter_button" id="mtq_button-1-1-1">
                                                <asp:Image ID="img" ImageUrl="" Visible="false" runat="server" />
                                                <asp:Literal ID="txtNum" runat="server"></asp:Literal>
                                                <asp:RadioButton ID="rbAnswer" runat="server" GroupName="Quest" Visible="false" AutoPostBack="true"
                                                    OnCheckedChanged="rbAnswer_CheckedChanged" />
                                                <asp:TextBox ID="txtAnswer" runat="server" Visible="false" AutoPostBack="true" OnTextChanged="txtAnswer_TextChanged"></asp:TextBox>
                                                <asp:CheckBox ID="ckbAnswer" runat="server" Visible="false" AutoPostBack="true" OnCheckedChanged="ckbAnswer_CheckedChanged" />
                                            </span><span id="mtq_marker-1-1-1" class="mtq_marker mtq_wrong_marker" alt="Wrong">
                                            </span>
                                        </td>
                                        <td class="mtq_answer_td">
                                            <span class="mtq_answer_text">
                                                <%# Eval("AnsName")%></span>
                                            <asp:HiddenField ID="hdNo" runat="server" Value="" />
                                            <asp:HiddenField ID="hdLine" runat="server" Value="" />
                                            <asp:HiddenField ID="hdAnsID" runat="server" Value="" />
                                        </td>
                                    </tr>
                                </ItemTemplate>
                                <LayoutTemplate>
                                    <table class="mtq_answer_table">
                                        <colgroup>
                                            <col class="mtq_oce_first">
                                        </colgroup>
                                        <tbody>
                                            <tr id="itemPlaceholder" runat="server">
                                            </tr>
                                        </tbody>
                                    </table>
                                </LayoutTemplate>
                            </asp:ListView>
                        </div>
                    </div>
                </div>
                <br />
                <asp:Label ID="lbExplan" runat="server" Font-Bold="True"> </asp:Label>
                <br />
                <table class="mtq_listrow" style="display: block;">
                    <tbody>
                        <tr>
                            <td class="mtq_listrow_button-td">
                                <asp:Button ID="btnPrev" runat="server" Text="" class="prev browse left mtq_back_button mtq_listrow_button disabled"
                                    BorderStyle="None" BorderWidth="0px" OnClick="btnPrev_Click" />
                            </td>
                            <td>
                                <table style="width: 300px; margin: auto">
                                    <tr>
                                        <td>
                                            <asp:Button ID="btnList" runat="server" Text="List" class="mtq_css_button" OnClick="btnList_Click"
                                                OnClientClick="openWin_ViewLookUp();return false;" />
                                        </td>
                                        <td>
                                            <asp:Button ID="btnHint" runat="server" Text="Hint" class="mtq_css_button" OnClick="btnHint_Click" />
                                        </td>
                                    </tr>
                                </table>
                            </td>
                            <td class="mtq_listrow_button-td">
                                <asp:Button ID="btnNext" runat="server" Text="" class="next browse right mtq_next-button mtq_listrow_button"
                                    BorderStyle="None" BorderWidth="0px" OnClick="btnNext_Click" />
                            </td>
                        </tr>
                    </tbody>
                </table>
            </span>
        <telerik:RadWindowManager ID="RadWindowManager2" runat="server" Modal="true" Skin="Vista"
            Height="500px" Width="350px" Style="z-index: 10000" VisibleStatusbar="False">
            <Windows>
                <telerik:RadWindow ID="Win_ViewReport" runat="server" Behavior="Default" OnClientClose="GetDataFromGrid_Report">
                </telerik:RadWindow>
            </Windows>
        </telerik:RadWindowManager>
        <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">

            <script type="text/javascript">
        function GetDataFromGrid_Report(sender,agrs)
        {
            var hdCOMMAND_TYPE = document.getElementById("<%=hdCOMMAND_TYPE.ClientID%>"); 
            hdCOMMAND_TYPE.value=agrs.get_argument().DlgRes;
            __doPostBack('<%=btnReload.UniqueID %>','');
        }
            </script>

        </telerik:RadCodeBlock>
        <asp:Button ID="btnReload" runat="server" Text="Button" CssClass="buttonHidden" OnClick="btnReload_Click" />
        <asp:HiddenField ID="hdCOMMAND_TYPE" runat="server" />
        <telerik:RadTextBox ID="txtTestID" runat="server" Visible="false">
        </telerik:RadTextBox>
        <telerik:RadTextBox ID="txtNo" runat="server" Visible="false">
        </telerik:RadTextBox>
    </div>
</asp:Content>
